﻿using UnityEngine;
using System.Collections;

public class TestMove : MonoBehaviour {

    public float t = 0;//控制计时器

    public float BGspeed = 0.25f;

    private bool IsBg = false;
	void Start () {
	
	}
	
	
	void Update () {
        if (IsBg)
        {
            t += Time.deltaTime * BGspeed;
            GetComponent<Renderer>().material.SetTextureOffset("_MainTex", new Vector2(t, 0));
        }
	}

    public void IsBgMove(bool IsOn)
    {
        IsBg = IsOn;
    }
}
